package com.powergisol.gis.controller;

import com.powergisol.gis.service.TabDataSettingService;
import com.powergisol.gis.service.TabProjectService;
import com.powergisol.gis.service.TabZuanKongService;
import com.powergisol.gis.util.Result;
import com.powergisol.gis.vo.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


/**
 * Created By marc
 * Date: 2020/9/17  18:42
 * Description:地下三维分析
 */
@RestController
@RequestMapping("/analysis")
public class UndergroundAnalysisController {

    @Autowired
    TabZuanKongService tabZuanKongService;

    @Autowired
    TabProjectService projectService;

    @Autowired
    private TabDataSettingService tabDataSettingService;

    @RequestMapping(value = "getBatchByUuuid", method = RequestMethod.POST)
    @ApiOperation(value = "根据uuid获取岩层对应数据导入批次项目", notes = "根据uuid获取岩层对应数据导入批次项目")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "String", name = "uuid", value = "岩层uuid", defaultValue = "0", required = true, paramType = "query")
    })
    public Result getBatchByUuuid(String uuid){
        Result r = new Result();
        r.setData(projectService.getByUuid(uuid));
        return r;
    }


    @RequestMapping(value = "invented", method = RequestMethod.POST)
    @ApiOperation(value = "虚拟钻孔生成", notes = "虚拟钻孔生成")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "String", name = "x", value = "经度", defaultValue = "0", required = true, paramType = "query"),
            @ApiImplicitParam(dataType = "String", name = "y", value = "纬度", defaultValue = "0", required = true, paramType = "query"),
            @ApiImplicitParam(dataType = "String", name = "z", value = "高度", defaultValue = "0", required = true, paramType = "query"),
            @ApiImplicitParam(dataType = "String", name = "uuid", value = "岩层uuid", defaultValue = "0", required = true, paramType = "query"),
            @ApiImplicitParam(dataType = "Integer", name = "settingId", value = "导入数据批次id", defaultValue = "0", required = true, paramType = "query")
    })
    public Result invented(SimulateZuanKongVo vo){
        return tabZuanKongService.simulateZuanKong(vo);
    }

    @RequestMapping(value = "slice", method = RequestMethod.POST)
    @ApiOperation(value = "地层剖切", notes = "地层剖切")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "List<double[]>", name = "point", value = "点", defaultValue = "0", required = true, paramType = "query"),
            @ApiImplicitParam(dataType = "double", name = "h", value = "高度", defaultValue = "0", required = true, paramType = "query"),
            @ApiImplicitParam(dataType = "String", name = "uuid", value = "岩层uuid", defaultValue = "0", required = true, paramType = "query")
    })
    public Result sliceZuanKong(@RequestBody SliceZuanKongVo vo){
        Result r = tabZuanKongService.sliceZuanKong(vo);
        return r;
    }

    @RequestMapping(value = "hole", method = RequestMethod.POST)
    @ApiOperation(value = "地层挖坑", notes = "地层挖坑")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "List<double[]>", name = "point", value = "点", defaultValue = "0", required = true, paramType = "query"),
            @ApiImplicitParam(dataType = "int", name = "height", value = "高度", defaultValue = "0", required = true, paramType = "query"),
            @ApiImplicitParam(dataType = "String", name = "uuid", value = "岩层uuid", defaultValue = "0", required = true, paramType = "query")
    })
    public Result holeZuanKong(@RequestBody SliceZuanKongVo vo){
        Result r = tabZuanKongService.holeZuanKong(vo);
        return r;
    }

    @RequestMapping(value = "zkfcSort", method = RequestMethod.POST)
    @ApiOperation(value = "钻孔分层排序", notes = "钻孔分层排序")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "String", name = "uuid", value = "岩层uuid", defaultValue = "0", required = true, paramType = "query")
    })
    public Result zkfcSort(String uuid){
        return tabZuanKongService.zkfcSort(uuid);
    }

    @RequestMapping(value = "zkfcUndup", method = RequestMethod.POST)
    @ApiOperation(value = "钻孔分层去重", notes = "钻孔分层去重")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "String", name = "uuid", value = "岩层uuid", defaultValue = "0", required = true, paramType = "query")
    })
    public Result zkfcUndup(String uuid){
        Result r = new Result();
        r.setData(tabDataSettingService.listByMarkerUndup(uuid));
        return r;
    }

}
